1 Background

The World Bank collects statistical information from countries around the world. A particularly useful data set is the World Development Indicators (WDI) which are country level statistical information from around the world.

R is unique in that using library(WDI) you can download indicator data directly from the World Bank, read it into a data set, and put it to use. Using library(plotly) you can even make cool looking motion charts, somewhat reminiscent of those popularized by Hans Rosling.

While the code below is seemingly arcane, it is important to recognize that it is simple in structure. It is very possible to re-purpose the code below using some of the many 1,000’s of WDI indicators that are of interest to you.

5 Take a Quick Look at the Data

7 Map

8 Globe

9 Plot the Motion Charts

9.1 Life Expectancy by Year

9.1.1 ggplot with ggplotly

9.1.2 plotly

9.2 Life Expectancy by GDP

9.3 Life Expectancy by Logged GDP

Using logged GDP on the x axis means that we are looking at relative, instead of absolute changes in GDP.